package com.gxh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.gxh.annotation.AutoFill;
import com.gxh.dto.SwiperPageQueryDTO;
import com.gxh.entity.Swiper;
import com.gxh.enumeration.OperationType;
import org.apache.ibatis.annotations.Update;

public interface SwiperMapper extends BaseMapper<Swiper> {

    /**
     * 分页查询
     * @param swiperPageQueryDTO
     * @return
     */
    Page<Swiper> pageQuery(SwiperPageQueryDTO swiperPageQueryDTO);

    /**
     * 新增轮播图
     * @param swiper
     */
    @Update("insert into swiper (title,img_url,sort,create_time,update_time,create_user,update_user) " +
            "values (#{title},#{imgUrl},#{sort},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    @AutoFill(OperationType.INSERT)
    void insertSwiper(Swiper swiper);

    /**
     * 修改轮播图
     * @param swiper
     */
    @AutoFill(OperationType.UPDATE)
    void updateSwiper(Swiper swiper);


}
